package main

import (
	"github.com/labstack/echo-contrib/echoprometheus"
	"github.com/labstack/echo/v4"
	"net/http"
)

// Add needed module go get -u github.com/labstack/echo-contrib
// Add Prometheus middleware and metrics serving route
func main() {
	e := echo.New()
	e.Use(echoprometheus.NewMiddleware("myapp"))   // adds middleware to gather metrics
	e.GET("/metrics", echoprometheus.NewHandler()) // adds route to serve gathered metrics
	e.GET("/index", Index)
	e.Start(":80")
}
func Index(c echo.Context) error {
	return c.String(http.StatusOK, "index success!")
}
